<%@ page language="java"  pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系统管理</title>
<link href="<%=path %>/styles/main.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/js/jpage/theme/black/css/jpage.css"  rel="stylesheet" type="text/css" media="screen">
<link href="<%=path %>/js/dialog/skin/ymPrompt.css"  rel="stylesheet" id='skin' type="text/css"/> 

<script type="text/javascript" src="<%=path%>/js/main.js"></script>
<script type="text/javascript" src="<%=path%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/jpage/jquery.jpage.js"></script>
<script type="text/javascript" src="<%=path %>/js/dialog/ymPrompt.js" ></script>
<script type="text/javascript">
	<!--
	function loadPage(){
	    var deptId=document.getElementById("deptId").value;
	    var empName=document.getElementById("empName").value;
		var cols=["empId","empNo","empName"];
		$("#container,#PagerTable,#RightMns").jpage({ proxyUrl:'<%=path%>/system/employee/listPage.do',
													ajaxParam:{'deptId':deptId,'empName':empName},
													groupSize:4,cols:cols,isView:true,
													hasCheck:true,keyField:'empId'});
	}
	$(document).ready(loadPage);
	
	function view(empId){
		ymPrompt.win({title:'员工详细',width:600,height:500,fixPosition:true,iframe:{id:'myId',name:'myName',src:'<%=path%>/system/employee/view.do?empId='+empId}})
	}
	function update(){
		var empId=getCheckedId();
		if(empId==null || empId==""){
			ymPrompt.alert({title:'提示对话框',message:'请您选择要修改的记录！'});			
		}else{
			view(empId);
		}
	}
	function add(){
		ymPrompt.win({title:'新增员工',width:600,height:500,fixPosition:true,iframe:{id:'myId',name:'myName',src:'<%=path%>/system/employee/toAdd.do'}})
	}
	function del(){
		var empId=getCheckedId();
		if(empId==null || empId==""){
			ymPrompt.alert({title:'提示对话框',message:'请您选择要修改的记录！'});
			return ;			
		}		
		ymPrompt.confirmInfo({title:'确认信息',message:'您是否要删除该记录？',handler:confirmhandler});
	}	
	function confirmhandler(type){
		if(type=="ok"){		
			var empId=getCheckedId();
			$.post("<%=path %>/system/employee/del.do",
			      	{empId:empId},
			      	function(data){      		 
			      		if(data=="delete"){		               
				            ymPrompt.succeedInfo({message:'删除成功！'});
				            loadPage();               	
			            }else{
			               	ymPrompt.errorInfo({title:'错误信息',message:'删除失败！'})             
			            }
			      	},"string");
		 }else{return ;}
	}
	var menuIndex=2;
	var topMenuIndex=1;
	//-->
</script>
</head>
<body>
<div id="container">
	<!-- 头部菜单 -->
	<%@ include file="../common/Header.jsp"%>
	<%@ include file="Menu.jsp"%>	
	<form method="post">	
	<div id="Content">
	    <table  class="TableSearch" width="100%" border="0" cellspacing="3" cellpadding="0">
			<tr>
				<td width="80" nowrap="nowrap">部门名称</td>
			    <td width="200">
			        <s:select  emptyOption="true" id="deptId" name="deptId" style="width:200px;" list="deptList"  listKey="orgId" listValue="orgName" />
			    </td>
			    <td width="50">&nbsp;</td>
			    <td width="80" nowrap="nowrap">员工名称</td>
			    <td width="200"><input name="empName" id="empName" type="text" class="InputText" onfocus="this.className='InputTextDown'" onblur="this.className='InputText'" /></td>
				<td width="50">&nbsp;</td>
				<td width="120"> 
					<tt><input name="Submit42" type="button"  onclick="loadPage()" class="But" value="检索" /></tt>
	            </td>
	            <td>&nbsp;</td>
			</tr>
		</table> 
	
		<table  class="TableList" width="100%" border="0" cellpadding="0" cellspacing="0">
		   	<thead>
	            <tr>
	              <th width="36" height="26" nowrap="nowrap">选择</th>
	              <th width="406" nowrap="nowrap">用工ID</th>
	              <th width="217">工号</th>
	              <th  nowrap="nowrap">员工名称</th>
	              <th width="60" nowrap="nowrap">基本信息</th>             
	            </tr>
			</thead>
			<tbody id="PagerTable"></tbody>	           
	    </table> 
	    
		<div  id="ListToolbar">
			<div style="float:left">
			    <tt><input class="But" type="button" name="BtnAdd" value="增加" onclick="add()" /> </tt> 
				<tt><input class="But" type="button" name="BtnDel" value="删除" onclick="del()"/></tt>
				<tt><input class="But" type="button" name="BthUpdate" value="修改" onclick="update()"/></tt>
	        </div>			
		    <div id="RightMns" style="float:right"></div> 
		</div>
	</div>
	</form>
</div>
</body>
</html>
